home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / strrchr.c < prev    next >
C/C++ Source or Header  |  1991-11-27  |  2KB  |  55 lines

  1. /*  $Revision: 1.2 $
  2. **
  3. **  This file has been modified to get it to compile more easily
  4. **  on pre-4.4BSD systems.  Rich $alz, June 1991.
  5. */
  6. #define NULL 0
  7. #define STRRCHR
  8.  
  9. /*
  10.  * Copyright (c) 1988 Regents of the University of California.
  11.  * All rights reserved.
  12.  *
  13.  * Redistribution and use in source and binary forms are permitted provided
  14.  * that: (1) source distributions retain this entire copyright notice and
  15.  * comment, and (2) distributions including binaries display the following
  16.  * acknowledgement:  ``This product includes software developed by the
  17.  * University of California, Berkeley and its contributors'' in the
  18.  * documentation or other materials provided with the distribution and in
  19.  * all advertising materials mentioning features or use of this software.
  20.  * Neither the name of the University nor the names of its contributors may
  21.  * be used to endorse or promote products derived from this software without
  22.  * specific prior written permission.
  23.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  24.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  25.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  26.  */
  27.  
  28. #if 0
  29. #if defined(LIBC_SCCS) && !defined(lint)
  30. static char sccsid[] = "@(#)rindex.c    5.8 (Berkeley) 6/23/90";
  31. #endif /* LIBC_SCCS and not lint */
  32.  
  33. #include <stddef.h>
  34. #include <string.h>
  35. #endif
  36.  
  37. char *
  38. #ifdef STRRCHR
  39. strrchr(p, ch)
  40. #else
  41. rindex(p, ch)
  42. #endif
  43.     register char *p, ch;
  44. {
  45.     register char *save;
  46.  
  47.     for (save = NULL;; ++p) {
  48.         if (*p == ch)
  49.             save = p;
  50.         if (!*p)
  51.             return(save);
  52.     }
  53.     /* NOTREACHED */
  54. }
  55.